Support engine "" {} to mean override to the default engine. (#70205)
authorOwen Taylor <otaylor@redhat.com>
Sat, 2 Feb 2002 16:37:23 +0000 (16:37 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 2 Feb 2002 16:37:23 +0000 (16:37 +0000)
Fri Feb  1 23:54:00 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support
        engine "" {} to mean override to the default
        engine. (#70205)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkrc.c
gtk/gtkrc.h

index 00d7ddd45744200b6b3d8d9b22f1479c1c0e7c02..2ad5e94d5ae1e45fd8493c508962a918f9fad5ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Feb  1 23:54:00 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support 
+       engine "" {} to mean override to the default 
+       engine. (#70205)
+
 Fri Feb  1 23:25:33 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktooltips.c (gtk_tooltips_init): Parse the
index 00d7ddd45744200b6b3d8d9b22f1479c1c0e7c02..2ad5e94d5ae1e45fd8493c508962a918f9fad5ad 100644 (file)
@@ -1,3 +1,9 @@
+Fri Feb  1 23:54:00 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support 
+       engine "" {} to mean override to the default 
+       engine. (#70205)
+
 Fri Feb  1 23:25:33 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktooltips.c (gtk_tooltips_init): Parse the
index 00d7ddd45744200b6b3d8d9b22f1479c1c0e7c02..2ad5e94d5ae1e45fd8493c508962a918f9fad5ad 100644 (file)
@@ -1,3 +1,9 @@
+Fri Feb  1 23:54:00 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support 
+       engine "" {} to mean override to the default 
+       engine. (#70205)
+
 Fri Feb  1 23:25:33 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktooltips.c (gtk_tooltips_init): Parse the
index 00d7ddd45744200b6b3d8d9b22f1479c1c0e7c02..2ad5e94d5ae1e45fd8493c508962a918f9fad5ad 100644 (file)
@@ -1,3 +1,9 @@
+Fri Feb  1 23:54:00 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support 
+       engine "" {} to mean override to the default 
+       engine. (#70205)
+
 Fri Feb  1 23:25:33 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktooltips.c (gtk_tooltips_init): Parse the
index 00d7ddd45744200b6b3d8d9b22f1479c1c0e7c02..2ad5e94d5ae1e45fd8493c508962a918f9fad5ad 100644 (file)
@@ -1,3 +1,9 @@
+Fri Feb  1 23:54:00 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support 
+       engine "" {} to mean override to the default 
+       engine. (#70205)
+
 Fri Feb  1 23:25:33 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktooltips.c (gtk_tooltips_init): Parse the
index 00d7ddd45744200b6b3d8d9b22f1479c1c0e7c02..2ad5e94d5ae1e45fd8493c508962a918f9fad5ad 100644 (file)
@@ -1,3 +1,9 @@
+Fri Feb  1 23:54:00 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support 
+       engine "" {} to mean override to the default 
+       engine. (#70205)
+
 Fri Feb  1 23:25:33 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktooltips.c (gtk_tooltips_init): Parse the
index 00d7ddd45744200b6b3d8d9b22f1479c1c0e7c02..2ad5e94d5ae1e45fd8493c508962a918f9fad5ad 100644 (file)
@@ -1,3 +1,9 @@
+Fri Feb  1 23:54:00 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support 
+       engine "" {} to mean override to the default 
+       engine. (#70205)
+
 Fri Feb  1 23:25:33 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktooltips.c (gtk_tooltips_init): Parse the
index 9b9e75a9c004a13c45c65c9c3eb90a5e7fdb6f81..6738950620e3aae95da1ffc474c12dd8c3acea40 100644 (file)
@@ -1940,9 +1940,10 @@ gtk_rc_init_style (GSList *rc_styles)
       GSList *tmp_styles;
       GType rc_style_type = GTK_TYPE_RC_STYLE;
 
-      /* Find the first derived style in the list, and use that to
-       * create the merged style. If we only have raw GtkRcStyles, use
-       * the first style to create the merged style.
+      /* Find the the first style where the RC file specified engine "" {}
+       * or the first derived style and use that to create the
+       * merged style. If we only have raw GtkRcStyles, use the first
+       * style to create the merged style.
        */
       base_style = rc_styles->data;
       tmp_styles = rc_styles;
@@ -1950,7 +1951,8 @@ gtk_rc_init_style (GSList *rc_styles)
        {
          GtkRcStyle *rc_style = tmp_styles->data;
           
-         if (G_OBJECT_TYPE (rc_style) != rc_style_type)
+         if (rc_style->engine_specified ||
+             G_OBJECT_TYPE (rc_style) != rc_style_type)
            {
              base_style = rc_style;
              break;
@@ -3013,34 +3015,62 @@ gtk_rc_parse_engine (GtkRcContext *context,
   if (token != G_TOKEN_STRING)
     return G_TOKEN_STRING;
 
-  engine = gtk_theme_engine_get (scanner->value.v_string);
-  
-  token = g_scanner_get_next_token (scanner);
-  if (token != G_TOKEN_LEFT_CURLY)
-    return G_TOKEN_LEFT_CURLY;
-
-  if (engine)
+  if (!scanner->value.v_string[0])
     {
-      GtkRcStyleClass *new_class;
+      /* Support engine "" {} to mean override to the default engine
+       */
+      token = g_scanner_get_next_token (scanner);
+      if (token != G_TOKEN_LEFT_CURLY)
+       return G_TOKEN_LEFT_CURLY;
       
-      new_style = gtk_theme_engine_create_rc_style (engine);
-      g_type_module_unuse (G_TYPE_MODULE (engine));
+      token = g_scanner_get_next_token (scanner);
+      if (token != G_TOKEN_RIGHT_CURLY)
+       return G_TOKEN_RIGHT_CURLY;
 
-      new_class = GTK_RC_STYLE_GET_CLASS (new_style);
+      parsed_curlies = TRUE;
 
-      new_class->merge (new_style, *rc_style);
-      if ((*rc_style)->name)
-       new_style->name = g_strdup ((*rc_style)->name);
+      if (G_OBJECT_TYPE (*rc_style) != GTK_TYPE_RC_STYLE)
+       {
+         new_style = gtk_rc_style_new ();
+         gtk_rc_style_real_merge (new_style, *rc_style);
+         
+         if ((*rc_style)->name)
+           new_style->name = g_strdup ((*rc_style)->name);
+       }
+      else
+       (*rc_style)->engine_specified = TRUE;
+    }
+  else
+    {
+      engine = gtk_theme_engine_get (scanner->value.v_string);
       
-      if (new_class->parse)
+      token = g_scanner_get_next_token (scanner);
+      if (token != G_TOKEN_LEFT_CURLY)
+       return G_TOKEN_LEFT_CURLY;
+      
+      if (engine)
        {
-         parsed_curlies = TRUE;
-         result = new_class->parse (new_style, context->settings, scanner);
-
-         if (result != G_TOKEN_NONE)
+         GtkRcStyleClass *new_class;
+         
+         new_style = gtk_theme_engine_create_rc_style (engine);
+         g_type_module_unuse (G_TYPE_MODULE (engine));
+         
+         new_class = GTK_RC_STYLE_GET_CLASS (new_style);
+         
+         new_class->merge (new_style, *rc_style);
+         if ((*rc_style)->name)
+           new_style->name = g_strdup ((*rc_style)->name);
+         
+         if (new_class->parse)
            {
-             g_object_unref (G_OBJECT (new_style));
-             new_style = NULL;
+             parsed_curlies = TRUE;
+             result = new_class->parse (new_style, context->settings, scanner);
+             
+             if (result != G_TOKEN_NONE)
+               {
+                 g_object_unref (G_OBJECT (new_style));
+                 new_style = NULL;
+               }
            }
        }
     }
@@ -3069,6 +3099,8 @@ gtk_rc_parse_engine (GtkRcContext *context,
 
   if (new_style)
     {
+      new_style->engine_specified = TRUE;
+      
       g_object_unref (G_OBJECT (*rc_style));
       *rc_style = new_style;
     }
index 4bc0940e58ab003a036433e82422f11cf951dacd..c202415d14df2c34198125b0d67b48cf9fc7dd08 100644 (file)
@@ -82,6 +82,8 @@ struct _GtkRcStyle
   GSList *rc_style_lists;
 
   GSList *icon_factories;
+
+  guint engine_specified : 1;  /* The RC file specified the engine */
 };
 
 struct _GtkRcStyleClass